using System;
using System.Collections.Generic;
using System.Text;
using LispLib;
using Noein.Control;

namespace Noein.GeneticAlgorithm.New
{
    public class Individual
    {
        private List<Interpreter.Pair> geno;
        public List<Interpreter.Pair> Genotype
        {
            get { return geno; }
        }

        private List<ScriptController> pheno;
        public List<ScriptController> Phenotype
        {
            get { return pheno; }
            set { pheno = value; }
        }

        private float fitness = -1f;
        public float Fitness
        {
            get { return fitness; }
            set { fitness = value; }
        }

        #region Problem Output

        private float averageSpeed;

        #endregion

        public Individual(List<Interpreter.Pair> genotype)
        {
            geno = genotype;
            pheno = Map(geno);
        }

        private List<ScriptController> Map(List<Interpreter.Pair> geno)
        {
            List<ScriptController> retval = new List<ScriptController>();

            
            for (int i = 0; i < geno.Count; i++)
            {
                string variable = String.Format("Muscles[{0}].Scalar", i);
                retval.Add(new ScriptController(geno[i], variable));
            }
            
            return retval;
        }
    }
}
